package com.museum.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.museum.entity.Visitor;
import com.museum.mapper.VisitorMapper;
import com.museum.service.VisitorService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class VisitorServiceImpl extends ServiceImpl<VisitorMapper, Visitor> implements VisitorService {

    @Override
    public List<Visitor> getUserVisitors(Long userId) {
        LambdaQueryWrapper<Visitor> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Visitor::getUserId, userId);
        wrapper.orderByDesc(Visitor::getCreateTime);
        return list(wrapper);
    }
} 